package cn.yunhe.alipay;
import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public  class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016093000632961";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDBJplnJJjbQSZsi2/uKJLhYvTl1WBqfLqbsvOxH9DSGyyqMf4pE3ASTgqjUl+BVkkfGoMGsuZJWUdVg2r6ygVGhP1RMo752uBV/fJ//hpgJjh84SoaOBTBX510fHHJzyPdFyblIuf2lvI8Mob/C8hXVTgmu8LfIrpX348es/faFzp6j9WVcqTx3kxjB0uQN3iqyLhDU7YrhIPEl0QdtS3zWhhEvkGRTBum/aSSNqvWgW34hOSgPZv+ldJ1ZQLPA66ur9X/+4Bn9zAzIQkVBe7V2+le0LZ0MIfIrKPnYOhFIAG8YsqkdXmqVZafmYmvapqEOQoSOmscvh2fV0hTHh9pAgMBAAECggEAU3P1+9aYJMN1cpicd+4X6EH1Rgh3bAsQJY2gNPtmIiGTnsWS5vR7C62kcwR4N02ssj+mNRK+5Rop9AygAFOhC+MSAC80D0g+fWkHib2kb76T0YEHy+RHM3W4dkf+cg+Jk1EZgQ8f4i894jyCj1fr66/qXvHpNLewg58YG0/u2s9E84x8NjxEF6Ik0LMgrQNSlsmrzw4lg/KboQnl9kPrEPwuF4c2aNnrNJyrktlTA//YxEYuq0465stzyBlHm0gZ9XJlyT736HF1bODUEGJEhy3PFGEnb69jnReTON6IILWf3a6BjOl2jx1OA0ixD/EFEHFEAhsnR51Eeg97fqcAcQKBgQD6hR7t4xUYffGXTYacXlBL4zv+pvitqgfXPpMmyxvrFAcR9gPfZchmzeqJx5G4zS9Op9RlyGVnCdMxbNTMI8dfNpKR7a2HEgE1qORzjZs5sgmzhfQ47W3KfBspDVAtEB5T/hoY910q2UHouitq348hW9pfXhBbxB+ZUUf3jttS6wKBgQDFYDfgsU/3Y3x9E9b1IiwIj5pMiSKdAnG4Y2TcQ23jrrEFenlO5PT4KT/yCjYXjKPYLk7BcUb9wvpxHwLal5C9kovleLZUsImd1RMGIWpNMYrEdJQOkd+apnpCnSaHWxIXdHQGTbSAf/a9CxZ+WYMeA1FIRd+yF5e3oHCwb3i5+wKBgQCaUjS6T99n5fVTwgMBAiwugz0q4kpgGFSaKEbXZ9i71+t/CfBaxkVL5t7qntBKacMRjdsOFAM7FNdPI/51/jhLk794O1Rg1xt9pZuM/xc21FCbkRHfm4q9Z/QHNtdD2yEDlo0XAhIXWhv6s+wY+rwdzYpYowYqsUbR2Dsf6ZV7nwKBgA8f5mhDbhtI9lsnUAuMyM8HIg3HXG2nqEs24p22VQ9jbZE751vSU6tIjevgOHDpiAyiz8onAgekD0jn1XImtyKvviShcWdf98uubjzEBr9PkpCnVkkfiIDzTN8Z57/rjKFbfSCWh8RpCeFGnjykY1XDb1EYeaHOCQQ7OSdsA1ZNAoGAXbA3l88NgWCUJCmYf8hwMVLFS+V4TkNl/Azvcp6qHnl9wZAWJBtDLRHe3kmbl0W9GuOhiJ2C4tknx/UazY9nmzKeTlLnL8jfwbK+x0b5SFD6kWoKEQBmIcrld7ZP5EVXWHEG7XZ6L9459duh95AlfDxjnjugtFU2WSE3epHAmTg=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwSaZZySY20EmbItv7iiS4WL05dVgany6m7LzsR/Q0hssqjH+KRNwEk4Ko1JfgVZJHxqDBrLmSVlHVYNq+soFRoT9UTKO+drgVf3yf/4aYCY4fOEqGjgUwV+ddHxxyc8j3Rcm5SLn9pbyPDKG/wvIV1U4JrvC3yK6V9+PHrP32hc6eo/VlXKk8d5MYwdLkDd4qsi4Q1O2K4SDxJdEHbUt81oYRL5BkUwbpv2kkjar1oFt+ITkoD2b/pXSdWUCzwOurq/V//uAZ/cwMyEJFQXu1dvpXtC2dDCHyKyj52DoRSABvGLKpHV5qlWWn5mJr2qahDkKEjprHL4dn1dIUx4faQIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://localhost:8080/before/AliplayNotifyServlet";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/before/AliplayReturnServlet";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

